﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SSCCMembership.Views
{
    public partial class LoginView : UserControl
    {
        public LoginView()
        {
            InitializeComponent();
            ViewModel = new SSCCMembership.ViewModels.LoginViewModel();
            ViewModel.FocusUsername += FocusUsername;
            txtUsername.Focus();
        }
        public SSCCMembership.ViewModels.LoginViewModel ViewModel 
        {
            get { return (SSCCMembership.ViewModels.LoginViewModel)DataContext; }
            set { DataContext = value; }
        }

        public event EventHandler LoggedIn 
        { 
            add { ViewModel.LoggedIn += value; }
            remove { ViewModel.LoggedIn -= value; } 
        }

        void FocusUsername(object sender, EventArgs e)
        {
            txtUsername.Focus();
        }
    }
}
